<?php /* SVN: $Id: add.ctp 51248 2011-04-22 11:37:47Z lakshmi_150act10 $ */ ?>
<div id="js-subdeal-<?php echo $i; ?>" class="js-subdeal-<?php echo $i; ?> {'available': 'Notpresent', 'main_deal_id': '';?>'}" >
   <fieldset class="form-block round-5">
		<legend class="round-5"><?php echo __l('SubDeal').' #'.($i+1); ?></legend>
	   <fieldset class="form-block round-5">
		<legend class="round-5"><?php echo __l('General'); ?></legend>
		<?php
			echo $form->input('Deal.'.$i.'.name',array('label' => __l('Name')));
		?>
				<div class="clearfix input-blocks">					
					<div class="input-block-right ">
						  <?php	echo $form->input('Deal.'.$i.'.max_limit', array('label'=>__l('No. of max. coupons'), 'info' => __l('Maximum limit of coupons can be bought for this deal. Leave blank for no limit.'))); ?>
					</div>
				 </div>
		  </fieldset>		  
		   <fieldset class="form-block round-5">
			<legend class="round-5"><?php echo __l('Price'); ?></legend>
				<?php
					if(Configure::read('site.currency_symbol_place') == 'left'):
						$currecncy_place = 'between';
					else:
						$currecncy_place = 'after';
					endif;	
				?>
				<?php
					$class = "{ 'DealOriginalPrice': 'Deal".$i."OriginalPrice', 'DealDiscountPercentage': 'Deal".$i."DiscountPercentage', 'DealDiscountAmount': 'Deal".$i."DiscountAmount', 'DealDiscountedPrice': 'Deal".$i."DiscountedPrice', 'DealSavings': 'Deal".$i."Savings', 'DealCalculatorDiscountedPrice': 'Deal".$i."CalculatorDiscountedPrice', 'DealCalculatorBonusAmount': 'Deal".$i."CalculatorBonusAmount', 'DealCalculatorCommissionPercentage': 'Deal".$i."CalculatorCommissionPercentage' , 'DealCalculatorMinLimit': 'Deal".$i."CalculatorMinLimit', 'DealBonusAmount': 'Deal".$i."BonusAmount', 'DealCommissionPercentage': 'Deal".$i."CommissionPercentage', 'ivalue': '".$i."'}";
					echo $form->input('Deal.'.$i.'.original_price',array('label' => __l('Original price'),'class' => "js-price js-sub-deal-price ".$class , $currecncy_place => '<span class="currency">'.Configure::read('site.currency'). '</span>')); ?>
					<div class="two-col-form clearfix">
						<?php echo $form->input('Deal.'.$i.'.discount_percentage', array('class' => "js-sub-deal-price ".$class ,'label' => __l('Discount (%)')));  ?>
						<span class="sep-or"><?php echo __l('OR'); ?></span>
						<?php echo $form->input('Deal.'.$i.'.discount_amount', array('class' => "js-sub-deal-amount ".$class ,'label' => __l('Discount Amount'), $currecncy_place => '<span class="currency">'.Configure::read('site.currency'). '</span>')); ?>
					</div>
					<?php echo $form->input('Deal.'.$i.'.savings', array('type'=>'text',  'label' => __l('Savings for user'),  'readonly' => 'readonly', $currecncy_place => '<span class="currency">'.Configure::read('site.currency'). '</span>'));
					echo $form->input('Deal.'.$i.'.discounted_price', array('label' => __l('Discounted price for user'),'type'=>'text', 'readonly' => 'readonly', $currecncy_place => '<span class="currency">'.Configure::read('site.currency'). '</span>'));
				?>                 
                <div class="page-info">
				<?php
					echo __l('When you want to add as a free deal, just give 100% discount for this deal');
				 ?>
			     </div>
			</fieldset>
		   <fieldset class="form-block round-5">
			<legend class="round-5"><?php echo __l('Commission'); ?></legend>
			 <div class="page-info">
				<?php
					echo __l('Total Commission Amount = Bonus Amount + ((Discounted Price * Number of Buyers) * Commission Percentage/100))');
				 ?>
			</div>
			<div class="clearfix">
			<div class="amount-block commision-form-block">
			<?php
			echo $form->input('Deal.'.$i.'.bonus_amount', array('class' => "js-sub-deal-bonus-amount ".$class ,'label' => __l('Bonus Amount'),'value' => '0.00',$currecncy_place => '<span class="currency">'.Configure::read('site.currency'). '</span>'));
            ?>
           <span class="info"> <?php echo __l('This is the flat fee that the company will pay for the whole deal.');?></span>
            <?php
        	echo $form->input('Deal.'.$i.'.commission_percentage', array('class' => "js-sub-deal-bonus-amount ".$class, 'info' => __l('This is the commission that company will pay for the whole deal in percentage.'), 'label' => __l('Commission (%)')));
			?>
			</div>
			<div class="calculator-block round-5">
				<?php echo $this->element('../deals/subdeal_commission_calculator', array('i'=> $i, 'class' => $class, 'cache' => array('time' => Configure::read('site.element_cache'), 'key' => $auth->user('id')))); ?>
			</div>
			</div>
        </fieldset>        
</fieldset>	   
</div>